g_hash_table_destroy (source_data->clients);
source_data->clients = NULL;
- if (source_data->timeout_id != 0)
- {
- g_source_remove (source_data->timeout_id);
- source_data->timeout_id = 0;
- }
+ g_clear_handle_id (&source_data->timeout_id, g_source_remove);
source_data->loaded = FALSE;
}
g_warning ("The calendar backend for '%s' has crashed.", display_name);
g_hash_table_remove (source_data->clients, source);
- if (source_data->timeout_id != 0)
- {
- g_source_remove (source_data->timeout_id);
- source_data->timeout_id = 0;
- }
+ g_clear_handle_id (&source_data->timeout_id, g_source_remove);
source_data->timeout_id = g_timeout_add_seconds (2, backend_restart,
source_data);
g_clear_signal_handler (&app->sources_signal_id, app->sources);
g_object_unref (app->sources);
- if (app->changed_timeout_id != 0)
- g_source_remove (app->changed_timeout_id);
+ g_clear_handle_id (&app->changed_timeout_id, g_source_remove);
g_free (app);
}
if (g_getenv ("HOTPLUG_SNIFFER_PERSIST") != NULL)
return;
- if (autoquit_id != 0)
- {
- g_source_remove (autoquit_id);
- autoquit_id = 0;
- }
+ g_clear_handle_id (&autoquit_id, g_source_remove);
}
static void
g_clear_object (&self->priv->cancellable);
g_clear_object (&self->priv->task);
- if (self->priv->watchdog_id != 0)
- {
- g_source_remove (self->priv->watchdog_id);
- self->priv->watchdog_id = 0;
- }
+ g_clear_handle_id (&self->priv->watchdog_id, g_source_remove);
G_OBJECT_CLASS (shell_mime_sniffer_parent_class)->dispose (object);
}
{
ShellAppUsage *self = SHELL_APP_USAGE (object);
- if (self->save_id > 0)
- g_source_remove (self->save_id);
+ g_clear_handle_id (&self->save_id, g_source_remove);
g_object_unref (self->privacy_settings);
if (self->watched_app)
g_object_unref (self->watched_app);
self->watched_app = NULL;
- if (self->save_id)
- {
- g_source_remove (self->save_id);
- self->save_id = 0;
- }
+ g_clear_handle_id (&self->save_id, g_source_remove);
}
self->enable_monitoring = enable;
static void
establish_timeout (void)
{
- if (timeout_id != 0)
- g_source_remove (timeout_id);
+ g_clear_handle_id (&timeout_id, g_source_remove);
timeout_id = g_timeout_add (opt_idle_timeout * 1000, on_timeout, NULL);
g_source_set_name_by_id (timeout_id, "[gnome-shell] on_timeout");
}
else
{
- g_source_remove (perf_log->statistics_timeout_id);
- perf_log->statistics_timeout_id = 0;
+ g_clear_handle_id (&perf_log->statistics_timeout_id, g_source_remove);
}
}
}
{
ShellRecorderSrc *src = SHELL_RECORDER_SRC (object);
- if (src->memory_used_update_idle)
- g_source_remove (src->memory_used_update_idle);
+ g_clear_handle_id (&src->memory_used_update_idle, g_source_remove);
shell_recorder_src_set_caps (src, NULL);
g_queue_free_full (src->queue, (GDestroyNotify) gst_buffer_unref);
{
ShellRecorder *recorder = SHELL_RECORDER (object);
- if (recorder->update_memory_used_timeout)
- g_source_remove (recorder->update_memory_used_timeout);
+ g_clear_handle_id (&recorder->update_memory_used_timeout, g_source_remove);
if (recorder->cursor_image)
cairo_surface_destroy (recorder->cursor_image);
static void
recorder_remove_redraw_timeout (ShellRecorder *recorder)
{
- if (recorder->redraw_timeout != 0)
- {
- g_source_remove (recorder->redraw_timeout);
- recorder->redraw_timeout = 0;
- }
+ g_clear_handle_id (&recorder->redraw_timeout, g_source_remove);
}
static void
static void
recorder_remove_update_pointer_timeout (ShellRecorder *recorder)
{
- if (recorder->update_pointer_timeout)
- {
- g_source_remove (recorder->update_pointer_timeout);
- recorder->update_pointer_timeout = 0;
- }
+ g_clear_handle_id (&recorder->update_pointer_timeout, g_source_remove);
}
static void
* us the events is close to free in any case.
*/
- if (recorder->redraw_idle)
- {
- g_source_remove (recorder->redraw_idle);
- recorder->redraw_idle = 0;
- }
+ g_clear_handle_id (&recorder->redraw_idle, g_source_remove);
}
static void
if (event->button != 1)
return FALSE;
- if (priv->paging_source_id)
- {
- g_source_remove (priv->paging_source_id);
- priv->paging_source_id = 0;
- }
+ g_clear_handle_id (&priv->paging_source_id, g_source_remove);
return TRUE;
}
if (priv->paging_source_id)
{
- g_source_remove (priv->paging_source_id);
- priv->paging_source_id = 0;
+ g_clear_handle_id (&priv->paging_source_id, g_source_remove);
return TRUE;
}